-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments block: Remove empty block wrapper #43383
Conversation
8fbb549
to
dad7549
Compare
I'll try to add a small unit test maybe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
In order for me to work, I had to remove and add again the Comments block on the Site Editor, is this a correct behavior?
Apart from that, it looks good to me (thanks for adding the clarifying comment in L42!
@c4rl0sbr4v0 , I would expect that, but I know it's not ideal. I think that happened because the block type was It should work fine with the old Would it make sense to do something similar (I mean the unregister/register thing) for cc: @ockham |
Thanks a lot for testing, @c4rl0sbr4v0 and @DAreRodz!
Hmm, I didn't really expect that, TBH 🤔
Hmm, I'm not sure that's accurate:
Is it possible that Gutenberg hadn't finished rebuilding when you were testing this? (Since this is block PHP, it actually has to go through the build step.) |
(Going to merge this since it has approval, but happy to continue discussing this!) |
Failing e2e tests are unrelated to this PR (and also present in other PRs and |
It could be, but I'm not pretty sure about that. I was using a TwentyTwo with a Anyway, I will be happy to re-test it in better conditions (that WP was really dirty from previous Comments testing) 😓 |
What?
If posting comments is disabled for a given post (and the post doesn't have any comments yet), we used to render an empty
<div class="wp-comments"> </div>
block wrapper. This PR removes that empty wrapper.This fixes #41957. (Note that the block used to be called "Comments Query Loop" at the time but has since been renamed to just "Comments".)
Why?
The empty wrapper would get in the way of some layouts, see #41957.
How?
Moving the check that bails early upon no comments further up in the block's
index.php
.Testing Instructions
Screenshots or screencast